package kr.hkit.androidcomplete01.ch05;

import kr.hkit.androidcomplete01.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class RelativeIfMissingEx extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.ch05_relativeifmissingex);
		
		findViewById(R.id.btntoggle).setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				ImageView img = (ImageView) findViewById(R.id.icon);
				if (img.getVisibility()==View.VISIBLE){
					img.setVisibility(View.GONE);
				}else{
					img.setVisibility(View.VISIBLE);
				}
				
			}
		});
		
		
		findViewById(R.id.btntoggle01).setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				ImageView img = (ImageView) findViewById(R.id.icon02);
				if (img.getVisibility()==View.VISIBLE){
					img.setVisibility(View.GONE);
				}else{
					img.setVisibility(View.VISIBLE);
				}
				
			}
		});
	}
}
